import request from '@/utils/request'
/**
 *
 * 专业管理
 *
 **/

 //分页查询
 export const getMajor = (params: any) =>
  request({
    'url': `/major/page`,
    'method': 'get',
    params
  })
 
  export function getMajorsByCollege(collegeId) {
    return request({
      url: `/major/list`,
      method: 'get',
      params: { collegeId }
    })}
    //新增专业
 export const addMajor = (params: any) =>
  request({
    'url': '/major',
    'method': 'post',
    data:params
  })

    //根据id查询专业
 export const findMajorById = (id: number) =>
  request({
    'url': `/major/${id}`,
    'method': 'get',
  })

      //更新专业
 export const updateMajor = (params: any) =>
  request({
    'url': '/major',
    'method': 'put',
    data:params
  })
  // 批量删除专业
  export const deleteBatchMajors = (ids: number[]) =>
    request({
      'url': `/major`,
      'method': 'delete',
      params: { 
        ids: ids.join(',') // 将数组转换为逗号分隔的字符串
      }
    })